<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CM系统</title>
    <link href="/cms/frame/bootstrap-4.6.2-dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: rgba(204, 229, 255, 0.2);
        }
        #welcome-container {
            text-align: center;
            font-family: 楷体;
        }
        #welcome {
            font-size: 36px; /* 欢迎语大一些的字体大小 */
            margin-bottom: 20px; /* 调整与当前时间之间的间距 */
        }
        #current-time {
            font-size: 24px;
        }
        #current-time {
            margin-top: 10px;
        }
    </style>
</head>
<body>
<div id="welcome-container">
    <div id="welcome"></div>
    <div id="current-time"></div>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            var now = new Date();
            var hours = now.getHours();
            var greeting;

            if (hours >= 6 && hours < 10) {
                greeting = "早上好";
            } else if (hours >= 10 && hours < 13) {
                greeting = "中午好";
            } else if (hours >= 13 && hours < 18) {
                greeting = "下午好";
            } else {
                greeting = "晚上好";
            }

            var welcomeMessage = "尊敬的管理员，"+greeting + "！欢迎您使用CM系统。";
            document.getElementById('welcome').textContent = welcomeMessage;

            // 显示当前时间
            displayCurrentTime();

            // 每1秒更新一次时间
            setInterval(displayCurrentTime, 1000);

            // 显示当前时间函数
            function displayCurrentTime() {
                var currentTime = new Date();
                var hours = currentTime.getHours();
                var minutes = currentTime.getMinutes();
                var seconds = currentTime.getSeconds();

                // 格式化时间
                var formattedTime = pad(hours) + ":" + pad(minutes) + ":" + pad(seconds);
                document.getElementById('current-time').textContent = "当前时间：" + formattedTime;
            }

            // 辅助函数：补零
            function pad(num) {
                return num < 10 ? "0" + num : num;
            }
        });
    </script>
</div>
</body>
</html>
